<?php
/**
 * Extuser Controller for com_extuser Component
 *
 * @package    Joomla
 * @subpackage Accounts
 * @license		GNU/GPL
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

/**
 * Accounts Controller
 *
 * @package    Joomla
 * @subpackage Components
 */
class ExtuserControllerExtuser extends ExtuserController
{
	/**
	 * constructor (registers additional tasks to methods)
	 * @return void
	 */
	function __construct()
	{
		parent::__construct();

		// Register Extra tasks
		$this->registerTask( 'add' , 'edit' );
		$this->registerTask( 'apply', 'save' );
	}

	function edit(){
		/*
		global $option;
		$row =& JTable::getInstance('Extuser', 'Table');
		$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
		$ABON = $cid[0];
		$row->load($ABON);
		HTML_extuser::editExtuser($row);
		*/
	}

	function save(){
		/*
		global $option;
		$row =& JTable::getInstance('Extuser', 'Table');
		if (!$row->bind(JRequest::get('post'))){
			echo "<script> alert('".$row->getError()."');" ."window.history.go(-1); </script>\n";
			exit();
		}
		$row->quicktake = JRequest::getVar( 'quicktake', '', 'post', 'string', JREQUEST_ALLOWRAW );
		$row->review = JRequest::getVar( 'review', '', 'post', 'string', JREQUEST_ALLOWRAW );
		if(!$row->review_date)	$row->review_date = date( 'Y-m-d H:i:s' );
		if (!$row->store()) {
			echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
			exit();
		}
		switch ($this->_task){
			case 'apply': $msg = 'Changes to Account saved';
			$link = 'index.php?option=' . $option . '&task=edit&cid[]='. $row->ABON;
			break;
			case 'save': default: $msg = 'Account Saved';
			$link = 'index.php?option=' . $option;
			break;
		}
		$this->setRedirect($link, $msg);
		*/
	}

	function show(){
		JRequest::setVar( 'view', 'extuser' );
		parent::display();
	}

	function remove(){
		/*
		global $option;
		$cid = JRequest::getVar( 'cid', array(), '', 'array' );
		$db =& JFactory::getDBO();
		if(count($cid)){
			$cids = implode( ',', $cid );
			$query = "DELETE FROM #__accounts WHERE ABON IN ( $cids )";
			$db->setQuery( $query );
			if (!$db->query()) {
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			}
		}
		$this->setRedirect( 'index.php?option=' . $option );
		*/
	}



	/**
	 * cancel editing a record
	 * @return void
	 */
	function cancel()
	{
		$msg = JText::_( 'Operation Cancelled' );
		$this->setRedirect( 'index.php?option=com_extuser', $msg );
	}
}
?>
